3.5.67 \(\int \sec ^2(c+d x) (a+i a \tan (c+d x))^n \, dx\) [467]

Optimal. Leaf size=32 \[ -\frac {i (a+i a \tan (c+d x))^{1+n}}{a d (1+n)} \]

[Out]

-I*(a+I*a*tan(d*x+c))^(1+n)/a/d/(1+n)

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 32, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.083, Rules used = {3568, 32} \begin {gather*} -\frac {i (a+i a \tan (c+d x))^{n+1}}{a d (n+1)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sec[c + d*x]^2*(a + I*a*Tan[c + d*x])^n,x]

[Out]

((-I)*(a + I*a*Tan[c + d*x])^(1 + n))/(a*d*(1 + n))

Rule 32

Int[((a_.) + (b_.)*(x_))^(m_), x_Symbol] :> Simp[(a + b*x)^(m + 1)/(b*(m + 1)), x] /; FreeQ[{a, b, m}, x] && N
eQ[m, -1]

Rule 3568

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rubi steps

\begin {align*} \int \sec ^2(c+d x) (a+i a \tan (c+d x))^n \, dx &=-\frac {i \text {Subst}\left (\int (a+x)^n \, dx,x,i a \tan (c+d x)\right )}{a d}\\ &=-\frac {i (a+i a \tan (c+d x))^{1+n}}{a d (1+n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(111\) vs. \(2(32)=64\).
time = 13.20, size = 111, normalized size = 3.47 \begin {gather*} -\frac {i 2^{1+n} e^{i (c+d x)} \left (e^{i d x}\right )^n \left (\frac {e^{i (c+d x)}}{1+e^{2 i (c+d x)}}\right )^{1+n} \sec ^{-n}(c+d x) (\cos (d x)+i \sin (d x))^{-n} (a+i a \tan (c+d x))^n}{d (1+n)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sec[c + d*x]^2*(a + I*a*Tan[c + d*x])^n,x]

[Out]

((-I)*2^(1 + n)*E^(I*(c + d*x))*(E^(I*d*x))^n*(E^(I*(c + d*x))/(1 + E^((2*I)*(c + d*x))))^(1 + n)*(a + I*a*Tan
[c + d*x])^n)/(d*(1 + n)*Sec[c + d*x]^n*(Cos[d*x] + I*Sin[d*x])^n)

________________________________________________________________________________________

Maple [A]
time = 0.10, size = 31, normalized size = 0.97

method result size
derivativedivides \(-\frac {i \left (a +i a \tan \left (d x +c \right )\right )^{1+n}}{a d \left (1+n \right )}\) \(31\)
default \(-\frac {i \left (a +i a \tan \left (d x +c \right )\right )^{1+n}}{a d \left (1+n \right )}\) \(31\)
risch \(-\frac {2 i {\mathrm e}^{\frac {i \pi \,\mathrm {csgn}\left (\frac {i {\mathrm e}^{2 i \left (d x +c \right )}}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right ) \mathrm {csgn}\left (\frac {i a \,{\mathrm e}^{2 i \left (d x +c \right )}}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right )^{2} n}{2}-\frac {i \pi \mathrm {csgn}\left (\frac {i {\mathrm e}^{2 i \left (d x +c \right )}}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right )^{3} n}{2}+2 i d x -\frac {i \pi \mathrm {csgn}\left (i {\mathrm e}^{2 i \left (d x +c \right )}\right )^{3} n}{2}+\frac {i \pi \mathrm {csgn}\left (\frac {i {\mathrm e}^{2 i \left (d x +c \right )}}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right )^{2} \mathrm {csgn}\left (\frac {i}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right ) n}{2}+i \pi \mathrm {csgn}\left (i {\mathrm e}^{2 i \left (d x +c \right )}\right )^{2} \mathrm {csgn}\left (i {\mathrm e}^{i \left (d x +c \right )}\right ) n -\frac {i \pi \,\mathrm {csgn}\left (i {\mathrm e}^{2 i \left (d x +c \right )}\right ) \mathrm {csgn}\left (i {\mathrm e}^{i \left (d x +c \right )}\right )^{2} n}{2}-\frac {i \pi \mathrm {csgn}\left (\frac {i a \,{\mathrm e}^{2 i \left (d x +c \right )}}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right )^{3} n}{2}+2 i c +\frac {i \pi \,\mathrm {csgn}\left (i {\mathrm e}^{2 i \left (d x +c \right )}\right ) \mathrm {csgn}\left (\frac {i {\mathrm e}^{2 i \left (d x +c \right )}}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right )^{2} n}{2}-\frac {i \pi \,\mathrm {csgn}\left (i {\mathrm e}^{2 i \left (d x +c \right )}\right ) \mathrm {csgn}\left (\frac {i {\mathrm e}^{2 i \left (d x +c \right )}}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right ) \mathrm {csgn}\left (\frac {i}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right ) n}{2}-\frac {i \pi \,\mathrm {csgn}\left (\frac {i {\mathrm e}^{2 i \left (d x +c \right )}}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right ) \mathrm {csgn}\left (\frac {i a \,{\mathrm e}^{2 i \left (d x +c \right )}}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right ) \mathrm {csgn}\left (i a \right ) n}{2}+\frac {i \pi \mathrm {csgn}\left (\frac {i a \,{\mathrm e}^{2 i \left (d x +c \right )}}{{\mathrm e}^{2 i \left (d x +c \right )}+1}\right )^{2} \mathrm {csgn}\left (i a \right ) n}{2}+2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}\right ) n -\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) n +n \ln \left (2\right )+n \ln \left (a \right )}}{\left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) d \left (1+n \right )}\) \(544\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(d*x+c)^2*(a+I*a*tan(d*x+c))^n,x,method=_RETURNVERBOSE)

[Out]

-I*(a+I*a*tan(d*x+c))^(1+n)/a/d/(1+n)

________________________________________________________________________________________

Maxima [A]
time = 0.29, size = 28, normalized size = 0.88 \begin {gather*} -\frac {i \, {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n + 1}}{a d {\left (n + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a+I*a*tan(d*x+c))^n,x, algorithm="maxima")

[Out]

-I*(I*a*tan(d*x + c) + a)^(n + 1)/(a*d*(n + 1))

________________________________________________________________________________________

Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 60 vs. \(2 (28) = 56\).
time = 0.38, size = 60, normalized size = 1.88 \begin {gather*} -\frac {2 i \, \left (\frac {2 \, a e^{\left (2 i \, d x + 2 i \, c\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right )^{n} e^{\left (2 i \, d x + 2 i \, c\right )}}{d n + {\left (d n + d\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a+I*a*tan(d*x+c))^n,x, algorithm="fricas")

[Out]

-2*I*(2*a*e^(2*I*d*x + 2*I*c)/(e^(2*I*d*x + 2*I*c) + 1))^n*e^(2*I*d*x + 2*I*c)/(d*n + (d*n + d)*e^(2*I*d*x + 2
*I*c) + d)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (i a \left (\tan {\left (c + d x \right )} - i\right )\right )^{n} \sec ^{2}{\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)**2*(a+I*a*tan(d*x+c))**n,x)

[Out]

Integral((I*a*(tan(c + d*x) - I))**n*sec(c + d*x)**2, x)

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 62 vs. \(2 (28) = 56\).
time = 0.73, size = 62, normalized size = 1.94 \begin {gather*} -\frac {i \, \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 2 i \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1}\right )^{n + 1}}{a d {\left (n + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(d*x+c)^2*(a+I*a*tan(d*x+c))^n,x, algorithm="giac")

[Out]

-I*((a*tan(1/2*d*x + 1/2*c)^2 - 2*I*a*tan(1/2*d*x + 1/2*c) - a)/(tan(1/2*d*x + 1/2*c)^2 - 1))^(n + 1)/(a*d*(n
+ 1))

________________________________________________________________________________________

Mupad [B]
time = 0.42, size = 104, normalized size = 3.25 \begin {gather*} \frac {2\,\left (\cos \left (2\,d\,x\right )+\sin \left (2\,d\,x\right )\,1{}\mathrm {i}\right )\,\left (\cos \left (2\,c\right )+\sin \left (2\,c\right )\,1{}\mathrm {i}\right )\,{\left (\frac {a\,\left (\cos \left (2\,c+2\,d\,x\right )+1+\sin \left (2\,c+2\,d\,x\right )\,1{}\mathrm {i}\right )}{\cos \left (2\,c+2\,d\,x\right )+1}\right )}^n}{d\,\left (n+1\right )\,\left (\cos \left (2\,c+2\,d\,x\right )\,1{}\mathrm {i}-\sin \left (2\,c+2\,d\,x\right )+1{}\mathrm {i}\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a*tan(c + d*x)*1i)^n/cos(c + d*x)^2,x)

[Out]

(2*(cos(2*d*x) + sin(2*d*x)*1i)*(cos(2*c) + sin(2*c)*1i)*((a*(cos(2*c + 2*d*x) + sin(2*c + 2*d*x)*1i + 1))/(co
s(2*c + 2*d*x) + 1))^n)/(d*(n + 1)*(cos(2*c + 2*d*x)*1i - sin(2*c + 2*d*x) + 1i))

________________________________________________________________________________________